package oop2;

/**
 * @author oldliu
 * @since 1.0
 */
public class Student {
    String name;
    int age;
    int javaScore;
    int htmlScore;
    //加了之后，无参的就没有了。。。用到的地方会有错误
    //this在对象内部，指代自己
    public Student(){

    }
    //就近原则。初始化姓名和年龄
    public Student(String name, int age){
        this.name=name;
        this.age=age;
        this.show();
    }
    //初始化name和java成绩
//    public Student(String name,int javaScore){
//        this.name=name;
//        this.javaScore=javaScore;
//    }
    public Student(String name){
        //Student(name,0,0,0);
        this(name,0,0,0);//首行
        System.out.println("这是一个参数的构造方法！");
    }
    public Student(String n, int a, int j, int h) {
        name = n;
        age = a;
        javaScore = j;
        htmlScore = h;
    }

    public void show() {
        System.out.println("这个学生名叫" + name + ",今年" + age + "岁");
        System.out.println("java成绩：" + javaScore);
        System.out.println("html成绩：" + htmlScore);
    }

}
